/* 
 * Useful data types. Additional data types should be declared here
 * Usually used in DataStore, but the low-level classes can use these too
 */

#ifndef STRUCTS_H
#define	STRUCTS_H

#include <string>
#include <deque>
using namespace std;

// Enum for types of accounts. Used in accountStruct

enum accountType {
    Client, Booking, Finance, HolidayM, General
};

// Enum for types of holiday. Used in bookStruct and holStruct

enum holidayType {
    Small, Triers, Great, Big
};

// Enum for status of booking. Used in bookStruct

enum bookingStatus {
    New, Edited, Incomplete, Invalid,
    Checked, Waitlist, Payment, Confirmed, Cancelled
};

/* 
 * Struct to store account data.
 * Also stores Client data, which is usually empty if user is not a client
 */
struct accountStruct {
    // Data common to all accounts
    accountType type;
    string user;
    string pass;
    /* 
     * IMPORTANT
     * When a new client is created, ID should be generated using rand()%999+1
     * Valid ID's are from 1 to 999.
     * When assigning a new ID, CHECK if ID is already present.
     * Use DataStore's findCustID() to check. (Non-zero means already present)
     * 
     * ID == 0 if user is NOT a client
     * 
     * ID is >= 1000 if user is a Holiday Manager. This ID should be assigned
     * sequentially
     */
    int ID;
};

//Struct to store booking data

struct bookStruct {
    /*
     * IMPORTANT
     * When a new booking is created, ref should be generated with rand()%9999+1
     * Valid refs are from 1 to 9999
     * When randoming a new ref, CHECK if ref is already present.
     * Use DataStore's findBookRef() to check. (Non-zero means already present)
     */
    int ref;
    // It is up to booking staff to verify validity of these 2 fields
    string name;
    string address;
    /* 
     * Before client enters the destination code, a list of packages should be displayed.
     * The option to enter a code should loop until the user enters a valid code.
     * The destination and type fields should automatically be filled for the user.
     */
    int code;
    string destination;
    holidayType type;
    /*
     * Client can freely enter dates in any format.
     * Booking staff should check for validity and revert.
     */
    string startDate1;
    string endDate1;
    string startDate2;
    string endDate2;
    /* 
     * Special needs of customer. 
     * System should autofill with <NONE> if user leaves it blank
     */
    string special;
    // Try to generate using time(), but no big deal if a static date is used
    string bookDate;
    // Set to 0 or New when booking is created.
    bookingStatus status;
    // CHANGE: Link client to booking instead of booking to client
    int clientID;
};

// Struct to store details of a holiday package

struct holStruct {
    /*
     * IMPORTANT
     * When a new holiday package is created, code should be generated
     * with rand()%99+1
     * Valid codes are from 1 to 99
     * When randoming a new code, CHECK if code is already present
     * Use DataStore's findHolCode() to check. (Non-zero if present)
     * 
     * Code is used to autofill details when client makes a booking
     */
    int code;
    // Holiday destination and type
    string destination;
    holidayType type;
    /*
     * ID of Holiday Manager responsible for this destination
     * Initialize or set to 0 if no HM is available
     */
    int managerID;
};

struct mail {
    bool read;
    string user;
    string contents;
};

#endif	/* STRUCTS_H */

